package com.schoolgard.entitybean;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Student entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "STUDENT")
public class Student implements java.io.Serializable {

	// Fields

	private Long studentid;
	private StudentType studentType;
	private String name;
	private BigDecimal sex;
	private Byte nation;
	private String idcard;
	private String cardid;
	private Date birthday;
	private String linkway;
	private Long classid;
	private Long status;
	private Date regtime;
	private String remark;
	private Long schoolid;
	private String studentno;
	private Set<StudentToDevice> studentToDevices = new HashSet<StudentToDevice>(
			0);
	private Set<PictureLog> pictureLogs = new HashSet<PictureLog>(0);
	private Set<CardLog> cardLogs = new HashSet<CardLog>(0);

	// Constructors

	/** default constructor */
	public Student() {
	}

	/** minimal constructor */
	public Student(Long studentid, StudentType studentType) {
		this.studentid = studentid;
		this.studentType = studentType;
	}

	/** full constructor */
	public Student(Long studentid, StudentType studentType, String name,
			BigDecimal sex, Byte nation, String idcard, String cardid,
			Date birthday, String linkway, Long classid, Long status,
			Date regtime, String remark, Long schoolid, String studentno,
			Set<StudentToDevice> studentToDevices, Set<PictureLog> pictureLogs,
			Set<CardLog> cardLogs) {
		this.studentid = studentid;
		this.studentType = studentType;
		this.name = name;
		this.sex = sex;
		this.nation = nation;
		this.idcard = idcard;
		this.cardid = cardid;
		this.birthday = birthday;
		this.linkway = linkway;
		this.classid = classid;
		this.status = status;
		this.regtime = regtime;
		this.remark = remark;
		this.schoolid = schoolid;
		this.studentno = studentno;
		this.studentToDevices = studentToDevices;
		this.pictureLogs = pictureLogs;
		this.cardLogs = cardLogs;
	}

	// Property accessors
	@Id
	@Column(name = "STUDENTID", unique = true, nullable = false, precision = 16, scale = 0)
	public Long getStudentid() {
		return this.studentid;
	}

	public void setStudentid(Long studentid) {
		this.studentid = studentid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TYPE", nullable = false)
	public StudentType getStudentType() {
		return this.studentType;
	}

	public void setStudentType(StudentType studentType) {
		this.studentType = studentType;
	}

	@Column(name = "NAME", length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "SEX", precision = 22, scale = 0)
	public BigDecimal getSex() {
		return this.sex;
	}

	public void setSex(BigDecimal sex) {
		this.sex = sex;
	}

	@Column(name = "NATION", precision = 2, scale = 0)
	public Byte getNation() {
		return this.nation;
	}

	public void setNation(Byte nation) {
		this.nation = nation;
	}

	@Column(name = "IDCARD", length = 40)
	public String getIdcard() {
		return this.idcard;
	}

	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}

	@Column(name = "CARDID", length = 100)
	public String getCardid() {
		return this.cardid;
	}

	public void setCardid(String cardid) {
		this.cardid = cardid;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "BIRTHDAY", length = 7)
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	@Column(name = "LINKWAY", length = 510)
	public String getLinkway() {
		return this.linkway;
	}

	public void setLinkway(String linkway) {
		this.linkway = linkway;
	}

	@Column(name = "CLASSID", precision = 16, scale = 0)
	public Long getClassid() {
		return this.classid;
	}

	public void setClassid(Long classid) {
		this.classid = classid;
	}

	@Column(name = "STATUS", precision = 16, scale = 0)
	public Long getStatus() {
		return this.status;
	}

	public void setStatus(Long status) {
		this.status = status;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "REGTIME", length = 7)
	public Date getRegtime() {
		return this.regtime;
	}

	public void setRegtime(Date regtime) {
		this.regtime = regtime;
	}

	@Column(name = "REMARK", length = 510)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "SCHOOLID", precision = 16, scale = 0)
	public Long getSchoolid() {
		return this.schoolid;
	}

	public void setSchoolid(Long schoolid) {
		this.schoolid = schoolid;
	}

	@Column(name = "STUDENTNO", length = 100)
	public String getStudentno() {
		return this.studentno;
	}

	public void setStudentno(String studentno) {
		this.studentno = studentno;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<StudentToDevice> getStudentToDevices() {
		return this.studentToDevices;
	}

	public void setStudentToDevices(Set<StudentToDevice> studentToDevices) {
		this.studentToDevices = studentToDevices;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<PictureLog> getPictureLogs() {
		return this.pictureLogs;
	}

	public void setPictureLogs(Set<PictureLog> pictureLogs) {
		this.pictureLogs = pictureLogs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<CardLog> getCardLogs() {
		return this.cardLogs;
	}

	public void setCardLogs(Set<CardLog> cardLogs) {
		this.cardLogs = cardLogs;
	}

}